From 243a9ec343d43620372bd2735a8f04f8ac099d6c Mon Sep 17 00:00:00 2001 From: "iap10@labyrinth.cl.cam.ac.uk" Date: Mon, 9 Aug 2004 17:38:41 +0000 Subject: [PATCH] bitkeeper revision 1.1159.1.24 (4117b6a1euBrYZVVvGdpODhTzq8iNA) Fix migrate to cope with domains that are paused. --- tools/libxc/xc_linux_save.c | 87 ++++++++++++++++++++++++++----------- 1 file changed, 61 insertions(+), 26 deletions(-) diff --git a/tools/libxc/xc_linux_save.c b/tools/libxc/xc_linux_save.c index 5a3edb2bd8..26abf632ae 100644 --- a/tools/libxc/xc_linux_save.c +++ b/tools/libxc/xc_linux_save.c @@ -240,6 +240,55 @@ static int analysis_phase( int xc_handle, u32 domid, return -1; } + +int suspend_and_state( int xc_handle, XcIOContext *ioctxt, + dom0_op_t *op, + full_execution_context_t *ctxt ) +{ + int i=0; + + xcio_suspend_domain(ioctxt); + +retry: + + if ( xc_domain_getfullinfo( xc_handle, ioctxt->domain, op, ctxt) ) + { + xcio_error(ioctxt, "Could not get full domain info"); + return -1; + } + + if ( (op->u.getdomaininfo.flags & + ( DOMFLAGS_SHUTDOWN | (SHUTDOWN_suspend<u.getdomaininfo.flags & DOMFLAGS_PAUSED ) + { + // try unpausing domain, wait, and retest + xc_domain_unpause( xc_handle, ioctxt->domain ); + + xcio_error(ioctxt, "Domain was paused. Wait and re-test. (%lx)", + op->u.getdomaininfo.flags); + usleep(10000); // 10ms + + goto retry; + } + + + if( ++i < 3 ) + { + usleep(10000); // 10ms + goto retry; + } + + xcio_error(ioctxt, "Unable to suspend domain. (%lx)", + op->u.getdomaininfo.flags); + + return -1; +} + int xc_linux_save(int xc_handle, XcIOContext *ioctxt) { dom0_op_t op; @@ -407,23 +456,17 @@ int xc_linux_save(int xc_handle, XcIOContext *ioctxt) last_iter = 1; - xcio_suspend_domain(ioctxt); - - if ( xc_domain_getfullinfo( xc_handle, domid, &op, &ctxt) ) - { - xcio_error(ioctxt, "Could not get full domain info"); - goto out; - } - - if ( (op.u.getdomaininfo.flags & - ( DOMFLAGS_SHUTDOWN | (SHUTDOWN_suspend<